const express = require('express');
const router = express.Router();
const cardController = require('../controllers/cardController');
const authMiddleware = require('../middlewares/auth');

// 需要认证的路由
router.use(authMiddleware.authenticate);

// 名片夹管理
router.post('/folders', cardController.createFolder);
router.get('/folders', cardController.getFolders);
router.get('/folders/details', cardController.getFoldersWithDetails);
router.put('/folders/:id', cardController.updateFolder);
router.delete('/folders/:id', cardController.deleteFolder);

// 名片管理
router.post('/folders/:folderId/cards', cardController.createCard);
router.get('/folders/:folderId/cards', cardController.getCards);
router.get('/cards/:id', cardController.getCard);
router.put('/cards/:id', cardController.updateCard);
router.delete('/cards/:id', cardController.deleteCard);

// 批量录入名片
router.post('/batch', cardController.batchCreateCards);

module.exports = router;
